#include <cstdio>

const int N = 200005;
int n, ans, a[N], b[32];

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("CF1101G Zero XOR Subset(LinerBase).in", "r", stdin);
  freopen("CF1101G Zero XOR Subset(LinerBase).out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), a[i] ^= a[i - 1];
  if (!a[n]) return printf("-1"), 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 31; ~j; --j)
      if ((a[i] >> j) & 1) {
        if (b[j])
          a[i] ^= b[j];
        else {
          b[j] = a[i], ++ans;
          break;
        }
      }
  printf("%d", ans);
  return 0;
}